<template>
  <div class="detail">
    <c-section title="门店建设基本信息">
      <template v-slot:right>
        <c-abnormal-preview path="/storeConstruction/exceptionManage" :query="{ constCode: detail.constCode, functionModel: 'SHOP_DECORATION' }" />
      </template>
      <c-list :column="3">
        <c-list-item label="门店编码" :value="detail.shopCode" />
        <c-list-item label="门店" :value="detail.shopName" />
        <c-list-item label="所属客户编码" :value="detail.clientCode" />
        <c-list-item label="所属客户" :value="detail.clientName" />
        <c-list-item label="所属办事处" :value="detail.officeName" />
        <c-list-item label="经销商名称" :value="detail.customerName" />
        <c-list-item label="经销商联系电话" :value="detail.customerPhone" />
        <c-list-item label="门店类型" dict-type-code="SHOP_TYPE" :value="detail.shopType" />
        <c-list-item label="门店业务类型" dict-type-code="BIZ_TYPE" :value="detail.shopBizType" />
        <c-list-item label="门店城市级别" dict-type-code="CITY_LEVEL" :value="detail.shopCityLevel" />
        <c-list-item label="门店详细地址" :value="detail.shopAddress" :span="2" />
        <c-list-item label="门店经营面积" suffix="m²" :value="detail.shopArea || 0" />

        <c-list-item label="门头装修总面积" suffix="m²" :value="detail.dheadDecorationTotalArea || 0" />
        <c-list-item label="卖场装修总面积" suffix="m²" :value="detail.shopDecorationTotalArea || 0" />
        <c-list-item label="门头实际验收面积" suffix="m²" :value="detail.acceptDheadTotalArea || 0" />
        <c-list-item label="卖场实际验收面积" suffix="m²" :value="detail.acceptShopTotalArea || 0" />

        <c-list-item label="门店建设项目号" :value="detail.constCode" />
        <c-list-item label="报图类型" dict-type-code="MARKET_TYPE" :value="detail.marketType" />
        <c-list-item label="门店建设类型" dict-type-code="CONST_TYPE" :value="detail.constType" />
        <c-list-item label="商家类别" dict-type-code="BIZMAN_TYPE" :value="detail.bizmanType" />
        <c-list-item label="装修形式" dict-type-code="DECORATION_FORM" :value="detail.decorationFormCal || detail.decorationForm" />
        <c-list-item label="验收类型" dict-type-code="ACCEPT_TYPE" :value="detail.acceptType" />
        <c-list-item style="color:#3DC094;cursor: pointer;" label="对应硬装验收任务号" :value="detail.upAcceptTaskCode" @click.native="toHardPage(detail.upAcceptTaskCode)" />
        <c-list-item label="形象督导" :value="detail.formSupervisorName" />
        <c-list-item label="是否验收" dict-type-code="BOOLEANS" :value="detail.isAccept" />
        <!-- <c-list-item label="形象督导" :value="detail.formSupervisorName" /> -->
        <!-- <c-list-item label="是否验收" :value="detail.isAccept" /> -->
        <c-list-item label="实际验收时间" :value="detail.actualAcceptTime" />
        <c-list-item label="验收项目专员" :value="detail.accepterName" />
        <c-list-item label="安排验收备注" :value="detail.acceptRemark" :span="2" />
        <c-list-item label="不验收原因" :value="detail.unacceptReason" :span="3" />
        <c-list-item label="验收结案类型" dict-type-code="DECORATION_CLOSED_TYPE" :value="detail.acceptEndType" />
        <c-list-item :span="3" label="异常验收明细" :value="detail.abnormalConfirmation" />

      </c-list>
    </c-section>
    <c-section title="门店验收问题明细">
      <c-table-box hide-func :index="false" no-request :data="tableData" :table-height="400" :table-config="tableConfig">
        <el-table-column slot="before" type="expand" width="50">
          <template v-slot="{row}">
            <div style="padding:10px">
              <c-table-box
                :index="false"
                :table-max-height="400"
                :data="row.problemDetailDTOList"
                hide-func
                :setting="false"
                :table-config="tableConfig1"
              />
            </div>
          </template>
        </el-table-column>
      </c-table-box>
    </c-section>
    <c-section title="软装验收附件">
      <!-- belong-model="SOFT_REPORT" -->
      <c-file-table-box v-model="files" type-code="ACCESS027,ACCESS137,ACCESS030" :editable="false" :model-id="$route.query.id" />
    </c-section>
    <div class="btn-container">
      <c-button type="primary" @click="clickBackHandle">返回</c-button>
    </div>
  </div>
</template>
<script>
import { getSoftDetail } from '@/api/check'
export default {
  name: 'CheckHardDetail',
  data() {
    return {
      detail: {},
      tableData: [],
      content: '哈哈哈哈的 free发refer分份儿饭哈哈哈哈哈/n      是出发的发是地方是DVD',
      tableConfig: {
        interfacePath: '',
        setting: [
          {
            prop: 'belongDuty',
            label: '责任归属'
          },
          {
            prop: 'principalName',
            label: '责任人'
          },
          {
            prop: 'acceptResult',
            label: '验收结果',
            propEnum: {
              appCode: 'slm',
              domainCode: 'marketing',
              dictTypeCode: 'ACCEPT_RESULT'
            }
            // formatData: v => {
            //   if (v.acceptResult === undefined || v.acceptResult === '') return
            //   return v.acceptResult === 1 ? '通过' : '不通过'
            // }
          },
          {
            prop: 'mustRectifyEndTime',
            label: '应整改完成时间',
            formatData: this.$parseTimeYMD('mustRectifyEndTime')
          },
          {
            prop: 'rectifyTaskCode',
            label: '整改任务编号'
          },
          {
            prop: 'actualRectifyEndTime',
            label: '实际整改完成时间',
            formatData: this.$parseTimeYMD('actualRectifyEndTime')
          }
        ]
      },
      tableConfig1: {
        setting: [
          {
            prop: 'problemType',
            label: '问题分类',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'PROBLEM_CATEGORY'
            }
          },
          {
            prop: 'haveProblem',
            label: '是否存在问题',
            propEnum: {
              domainCode: 'marketing',
              appCode: 'slm',
              dictTypeCode: 'BOOLEANS'
            }
          },
          {
            prop: 'problemDesc',
            label: '验收问题说明',
            minWidth: 200,
            render: function(createElement, rows) {
              if (rows.problemDesc) {
                return (<div style='white-space:pre-wrap'>{rows.problemDesc }</div>
                )
              }
              return ''
            }
          },
          {
            prop: 'rectifyDesc',
            label: '整改项说明',
            minWidth: 160,
            render: function(createElement, rows) {
              if (rows.rectifyDesc) {
                return (<div style='white-space:pre-wrap'>{rows.rectifyDesc }</div>
                )
              }
              return ''
            }
          },
          {
            prop: 'rectifyResult',
            label: '整改结果',
            minWidth: '100'
          }
        ]
      },
      files: []
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    toHardPage(param) {
      if (param) {
        // 打开新页签
        this.$router.push({ path: '/check/hard/detail', query: { taskCode: param, id: this.detail.hardId, unitCode: this.detail.constUnitCode }})
      }
    },
    getDetail() {
      const { id } = this.$route.query
      getSoftDetail(id).then(res => {
        this.detail = res.data
        this.tableData = this.detail.softAcceptDutyDTOList
      })
    },
    clickBackHandle() {
      // this.$router.push({ name: 'CheckSoft' })
      this.$store.dispatch('views/goBack')
    }
  }
}
</script>
<style lang="scss" scoped>
.detail{

}
</style>
